# encoding=utf-8
# author:梁子龙
# 三种泛形
from typing import TypeVar
from db import DBModelBase
from pydantic import BaseModel
# 三种泛形
ModelType = TypeVar("ModelType", bound=DBModelBase)
CreateSchema = TypeVar("CreateSchema", bound=BaseModel)
UpdateSchema = TypeVar("UpdateSchema", bound=BaseModel)


class InDBMixin(BaseModel):
    """
    定义一个基类
    """

    class Config:
        #属性可以从ORM，把orm数据库的对象变成pydantic对象
        #orm_mode
        from_attributes = True
